package com.zjf.bbs.struts.action.post;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.stereotype.Controller;


import com.zjf.bbs.dao.PlatDao;
import com.zjf.bbs.dao.PostDao;
import com.zjf.bbs.entity.Plat;
import com.zjf.bbs.entity.Post;
import com.zjf.bbs.struts.formbean.post.PostViewForm;
@Controller(value="/postView1")
public class PostViewAction1 extends Action {
	@Resource(name="postDao")
	private PostDao postDao;
	@Resource(name="platDao")
	private PlatDao platDao;
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		PostViewForm f = (PostViewForm) form;
		Integer id = f.getSid();
		Post data = postDao.get(Post.class, id);
		List<Plat> datas = platDao.getScrollData(Plat.class, null);
		
		request.setAttribute("datas", datas);
		request.setAttribute("data", data);
		return mapping.findForward("view");
	}
}
